//
//  CKLSoundStretch.h
//  SoundDemo
//
//  Created by wankang on 1/23/15.
//  Copyright (c) 2015 wankang. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol WaveOutDelegate <NSObject>
@optional
-(void)initSampleRate:(NSInteger)nSampleRate bits:(NSInteger)nBits channel:(NSInteger)nChannel;
-(void)waveOutSample:(const void *)pcmData dataLength:(NSInteger)nBytes;
-(void)endWaveOut;
@end

@interface CKLSoundStretch : NSObject {
    
}

@property (nonatomic) NSString *strFileIn;
@property (nonatomic) NSString *strFileOut;
@property (nonatomic) NSString *strTmpFolder;
@property (nonatomic, weak) id<WaveOutDelegate> delegate;

-init;
-initWithInFile:(NSString *)sInFile andOutFile:(NSString *)sOutFile;
-(void)dealloc;

-(void)close;
/** recommendations
 * tempo: +50 for faster; -25 for slower
 */
-(BOOL)convertWithTempoDelta:(NSInteger)tempo pitchDelta:(NSInteger)pitch rateDelta:(NSInteger)rate
                  inFastMode:(BOOL)fFast forSpeech:(BOOL)fSpeech;
/** recommendations
 * tempo: +50 for faster; -25 for slower
 */
-(BOOL)makeSpeechInWaveFasterOrSlower:(NSInteger)tempo;
/** to convert .mp3 file to .wav file or .pcm file
 * return error information; nil if succeed.
 */
+(NSString *)convertMp3File:(NSString *)sInFile toFile:(NSString *)sOutFile inWaveFormat:(BOOL)fWaveFile;
/** to convert .mp3 file to NSData
 * return nil, if fail.
 */
+(NSData *)getWaveDataFromMp3File:(NSString *)sInFile;
@end
